//单点修改+区间查询
#include <iostream>
using namespace std;

#define lc p << 1
#define rc p << 1 | 1

typedef long long ll;
const int N = 5e5 + 10;
ll a[N];
int n, m;

struct tree
{
    ll l, r, sum;
}tr[N << 2];

//整合左右孩子信息
void pushup(int p)
{
    tr[p].sum = tr[lc].sum + tr[rc].sum;
}

//构建编号p为根, 维护[l, r]区间的和
void build(int p, int l, int r)
{
    tr[p] = {l, r, a[l]};
    if(l == r) return;
    int mid = (l + r) / 2;
    build(lc, l, mid);
    build(rc, mid + 1, r);
    pushup(p);
}

//单点修改, 将x位置的值+k
void modify(int p, int x, int k)
{
    int l = tr[p].l, r = tr[p].r;
    if(l == x && r == x)
    {
        tr[p].sum += k;
        return;
    }
    int mid = (l + r) >> 1;
    if(x <= mid) modify(lc, x, k);
    else modify(rc, x, k);
    pushup(p);
}

//查询根编号为p, 区间为[x, y]的和
int query(int p, int x, int y)
{
    int l = tr[p].l, r = tr[p].r, mid = (l + r) / 2;
    if(x <= l && r <= y) return tr[p].sum;
    ll sum = 0;
    if(x <= mid) sum += query(lc, x, y);
    if(y > mid) sum += query(rc, x, y);
    return sum;
}

int main()
{
    cin >> n >> m;
    for(int i = 1; i <= n; i++) cin >> a[i];
    build(1, 1, n);
    while(m--)
    {
        int op, x; cin >> op >> x;
        if(op == 1)
        {
            int k; cin >> k;
            modify(1, x, k);
        }
        else
        {
            int y; cin >> y;
            cout << query(1, x, y) << endl;
        }
    }
    return 0;
}